import 'package:json_annotation/json_annotation.dart';

part 'miffy_recipe_info_api.g.dart';

@JsonSerializable()
class ResponseMiffyRecipeInfoApi {
  final int id;
  final bool isLikes;
  final List<CookStepInfo> cookStepInfoVOList;
  final String productIds;
  final int cookType;
  final bool isCollect;

  ResponseMiffyRecipeInfoApi({
    required this.id,
    required this.isLikes,
    required this.cookStepInfoVOList,
    required this.productIds,
    required this.cookType,
    required this.isCollect,
  });

  factory ResponseMiffyRecipeInfoApi.fromJson(Map<String, dynamic> json) =>
      _$ResponseMiffyRecipeInfoApiFromJson(json);

  Map<String, dynamic> toJson() => _$ResponseMiffyRecipeInfoApiToJson(this);
}

@JsonSerializable()
class CookStepInfo {
  final List<StepPara> stepParaVos;
  final int gmtModified;
  final int step;
  final String creatorId;
  final String desc;

  CookStepInfo({
    required this.stepParaVos,
    required this.gmtModified,
    required this.step,
    required this.creatorId,
    required this.desc,
  });

  factory CookStepInfo.fromJson(Map<String, dynamic> json) =>
      _$CookStepInfoFromJson(json);

  Map<String, dynamic> toJson() => _$CookStepInfoToJson(this);
}

@JsonSerializable()
class StepPara {
  final String? dpCode;
  final String? functionPointCode;
  final String? dataType;
  final int? id;
  final String? productId;
  final String? enumData;
  final String? dbValue;
  final int? stepLength;
  final List<EnumDataJson>? enumDataJsons;
  final String? functionPointName;
  final String? numUnit;

  StepPara({
    required this.dpCode,
    required this.functionPointCode,
    required this.dataType,
    required this.id,
    required this.productId,
    required this.enumData,
    required this.dbValue,
    required this.stepLength,
    required this.enumDataJsons,
    required this.functionPointName,
    required this.numUnit,
  });

  factory StepPara.fromJson(Map<String, dynamic> json) =>
      _$StepParaFromJson(json);

  Map<String, dynamic> toJson() => _$StepParaToJson(this);
}

@JsonSerializable()
class EnumDataJson {
  final String? name;
  final String? value;

  EnumDataJson({required this.name, required this.value});

  factory EnumDataJson.fromJson(Map<String, dynamic> json) =>
      _$EnumDataJsonFromJson(json);

  Map<String, dynamic> toJson() => _$EnumDataJsonToJson(this);
}
